package com.icecloud.cloud.filestore.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.ClientAlreadyExistsException;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true)
public class ClientDetailStoreService {

	@Autowired
	private JdbcClientDetailsService jdbcClientDetailsService;

	/**
	 * 添加客户端信息
	 * 
	 * @param clientDetails
	 * @throws ClientAlreadyExistsException
	 */
	@Transactional(readOnly = false)
	public void addClientDetails(ClientDetails clientDetails) throws ClientAlreadyExistsException {
		jdbcClientDetailsService.addClientDetails(clientDetails);
	}

	/**
	 * 获取客户列表
	 * 
	 * @param companyId
	 * @return
	 */
	public List<ClientDetails> list() {
		return jdbcClientDetailsService.listClientDetails();
	}

}
